package com.example.photo.model.VO;

import com.example.photo.model.domain.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户信息对象
 *
 * @author Lwh
 * @time 2023/03/26 14:53
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVO {
    private Integer userId;

    private String username;

    private String nickname;

    private String avatar;

    private String email;

    private Integer isTju = 0;

    private Integer isAdmin = 0;

    public UserVO(User user) {
        this.userId = user.getUserId();
        this.username = user.getUsername();
        this.nickname = user.getNickname();
        this.avatar = user.getAvatar();
        this.email = user.getEmail();
        this.isTju = user.getIsTju() == null ? 0 : user.getIsTju();
        this.isAdmin = user.getIsAdmin() == null ? 0 : user.getIsAdmin();
    }
}
